#ifndef D3DAPP_H
#define D3DAPP_H

#include "D3dUtil.h"
#include "GameTimer.h"

class D3DApp
{
public:
	// Constructeur
	D3DApp(HINSTANCE hInstance
		  , std::string winCaption
		  , D3DDEVTYPE devType
		  , DWORD requestedVP);

	virtual ~D3DApp();

	HINSTANCE GetAPPInstance()		{ return mhAppInst; }
	HWND GetMainWnd()				{ return mhMainWnd; }
	D3DPRESENT_PARAMETERS GetD3Dpp(){ return md3dpp; }

	// Framework methods.
	virtual bool CheckDeviceCaps()		{ return true; }
	virtual void OnLostDevice()			{}
	virtual void OnResetDevice()		{}
	virtual void UpdateScene(float dt)	{}
	virtual void DrawScene()			{}

	// Override these methods only if you do not like the default windows creation.
	virtual void InitMainWindow();
	virtual void InitDirect3D();
	virtual int Run();
	virtual LRESULT msgProc(UINT msg, WPARAM wParam, LPARAM lParam);

	void EnableFullScreenMode(bool enable);
	bool IsDeviceLost();

private:
	std::string mWindowCaption;
	D3DDEVTYPE mDevType;
	DWORD mRequestedVP;

	HINSTANCE mhAppInst;
	HWND mhMainWnd;
	IDirect3D9* md3dObject;
	bool mAppPaused;
	D3DPRESENT_PARAMETERS md3dpp;

	GameTimer* timer;
};

#endif